import {
  q as r,
  p as V,
  ap as M,
  X as C,
  f as R,
  H as T,
  av as B,
  aw as O,
  k as t,
  m as a,
  l as s,
  az as P,
  as as i,
  aG as j,
  at as y,
  b0 as F
} from "./index-30f27935.js";
function q(E) {
  const d = r([]),
    n = r(!0);
  r({}), V();
  const v = r(1),
    g = r(10),
    x = r(""),
    b = M("reload"),
    p = C({
      pageSize: 10,
      currentPage: 1,
      pageSizes: [10, 20, 30],
      total: 0,
      align: "right",
      background: !0,
      small: !1
    }),
    w = C({
      text: "正在加载第一页...",
      viewBox: "-10, -10, 50, 50",
      spinner: `
        <path class="path" d="
          M 30 15
          L 28 17
          M 25.61 25.61
          A 15 15, 0, 0, 1, 15 30
          A 15 15, 0, 1, 1, 27.99 7.5
          L 15 15
        " style="stroke-width: 4px; fill: rgba(0, 0, 0, 0)"/>
      `
    }),
    A = [
      {
        type: "selection",
        width: 55,
        align: "left",
        hide: ({ checkList: e }) => !e.includes("勾选列")
      },
      {
        label: "序号",
        type: "index",
        width: 70,
        hide: ({ checkList: e }) => !e.includes("序号列")
      },
      { label: "ID", prop: "id", minWidth: 50 },
      {
        label: "乙方信息",
        prop: "yi_name",
        minWidth: 80,
        formatter: ({ yi_name: e, yi_phone: l }) =>
          t("div", null, [t("div", null, [e]), t("div", null, [l])])
      },
      {
        label: "乙方(证件)信息",
        prop: "card_name",
        minWidth: 100,
        formatter: ({ card_name: e, card_code: l }) =>
          t("div", null, [t("div", null, [e]), t("div", null, [l])])
      },
      {
        label: "甲方信息",
        prop: "jia_name",
        minWidth: 100,
        formatter: ({ jia_name: e, jia_phone: l }) =>
          t("div", null, [t("div", null, [e]), t("div", null, [l])])
      },
      {
        label: "甲方(证件)信息",
        prop: "sugg_name",
        minWidth: 100,
        formatter: ({ sugg_name: e, sugg_code: l }) =>
          t("div", null, [t("div", null, [e]), t("div", null, [l])])
      },
      {
        label: "合同编号",
        prop: "code_num",
        minWidth: 120,
        formatter: ({ code_num: e }) => {
          if (e == 0)
            return t(
              s("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [a("暂无")] }
            );
          if (e == 1)
            return t(
              s("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [a("一星合伙人 (合同)")] }
            );
          if (e == 2)
            return t(
              s("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [a("二星合伙人 (合同)")] }
            );
          if (e == 3)
            return t(
              s("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [a("三星合伙人 (合同)")] }
            );
          if (e == 4)
            return t(
              s("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [a("四星合伙人 (合同)")] }
            );
          if (e == 5)
            return t(
              s("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [a("五星合伙人 (合同)")] }
            );
          if (e == 6)
            return t(
              s("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [a("一星联创 (合同)")] }
            );
          if (e == 7)
            return t(
              s("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [a("二星联创 (合同)")] }
            );
          if (e == 8)
            return t(
              s("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [a("三星联创 (合同)")] }
            );
          if (e == 9)
            return t(
              s("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [a("四星联创 (合同)")] }
            );
          if (e == 10)
            return t(
              s("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [a("一星董事 (合同)")] }
            );
          if (e == 11)
            return t(
              s("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [a("二星董事 (合同)")] }
            );
          if (e == 12)
            return t(
              s("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [a("三星董事 (合同)")] }
            );
        }
      },
      {
        label: "状态",
        prop: "status",
        minWidth: 80,
        formatter: ({ status: e }) => {
          if (e == 4)
            return t(
              s("el-tag"),
              { class: "mx-1", type: "danger", effect: "light" },
              { default: () => [a("已驳回")] }
            );
          if (e == 3)
            return t(
              s("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [a("已通过")] }
            );
          if (e == 2)
            return t(
              s("el-tag"),
              { class: "mx-1", type: "warning", effect: "light" },
              { default: () => [a("待审核")] }
            );
        }
      },
      { label: "创建时间", prop: "create_time", minWidth: 100 },
      { label: "操作", fixed: "right", width: 80, slot: "operation" }
    ],
    W = R(() => [
      "!h-[20px]",
      "reset-margin",
      "!text-gray-500",
      "dark:!text-white",
      "dark:hover:!text-primary"
    ]);
  async function D(e) {
    P(e);
  }
  async function S(e) {
    const l = { role_id: e.role_id },
      c = JSON.stringify(l),
      o = { value: i.enc.Base64.stringify(i.enc.Utf8.parse(c)) },
      u = await j(o);
    u.code == 200
      ? (y("删除成功", { type: "success" }), b())
      : y(u.msg, { type: "error" });
  }
  function I() {}
  function J(e) {
    (g.value = e), h(void 0, e);
  }
  function k(e) {
    (v.value = e), h(e, void 0);
  }
  function z(e) {}
  function U(e) {
    (w.text = `正在加载第${e}页...`),
      (n.value = !0),
      B(600).then(() => {
        n.value = !1;
      });
  }
  async function L(e) {
    (n.value = !0), (x.value = e.user_phone);
    const l = { page: 1, pagesize: g.value, user_phone: e.user_phone },
      c = JSON.stringify(l),
      o = { value: i.enc.Base64.stringify(i.enc.Utf8.parse(c)) },
      { data: u } = await F(o);
    (d.value = u.data),
      (p.total = u.total),
      setTimeout(() => {
        n.value = !1;
      }, 500);
  }
  async function h(e = v.value, l = g.value) {
    const c = { page: e, pagesize: l, userPhone: x.value },
      m = JSON.stringify(c),
      u = { value: i.enc.Base64.stringify(i.enc.Utf8.parse(m)) },
      f = await F(u);
    f.code === 200
      ? ((d.value = f.data.data),
        (p.total = f.data.total),
        setTimeout(() => {
          n.value = !1;
        }, 500))
      : y(f.msg, { type: "error" });
  }
  const N = e => {
    e && (e.resetFields(), location.reload());
  };
  return (
    T(() => {
      B().then(() => {
        const { setWatermark: e } = O(E.value.getTableDoms().tableWrapper);
        e("后台项目", {
          font: "16px Microsoft YaHei",
          globalAlpha: 0.8,
          forever: !0,
          width: 252,
          height: 80
        });
      }),
        h();
    }),
    {
      loading: n,
      columns: A,
      dataList: d,
      pagination: p,
      buttonClass: W,
      onSearch: L,
      resetForm: N,
      handleaddUser: I,
      handleUpdate: D,
      handleDelete: S,
      handleSizeChange: J,
      handleCurrentChange: k,
      handleSelectionChange: z,
      onCurrentChange: U
    }
  );
}
export { q as useRole };
